<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>水滴作业辅导后台管理系统</title>
    <meta name="keywords" content="水滴作业辅导后台管理中心"/>
    <meta name="description" content="水滴作业辅导后台管理中心。"/>
    <link rel="stylesheet" href="__PUBLIC__/css/pintuer.css">
    <link rel="stylesheet" href="__PUBLIC__/css/admin.css?v=5">
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/public.js"></script>

    <style>

        .item-plain {
            text-align: left;
            font-size: 15px;
            padding: 10px 0 10px 22px;
            transition: all .1s ease-in-out;
            cursor: pointer;
            font-weight: bold;
            border-top: 1px solid #b5cfd9;
        }

        .item-plain a {
            display: block;
            width: 100%;
            height: 100%;
        }

        .item-plain span {
            margin-right: 10px;
        }

        .salecount {
            font-style: normal;
            color: red;
            font-weight: normal;
            font-size: 14px;
        }
    </style>
</head>
<body style="background-color:#f2f9fd;">
<div class="header bg-main">
    <div class="logo margin-big-left fadein-top">
        <h1><img src="__PUBLIC__/images/1538988424.png" class="radius-circle rotate-hover" height="50" alt=""/>水滴作业辅导后台管理中心
        </h1>
    </div>
    <div class="head-l">
        <a id="logout" class="button button-little bg-red" href="{:U('login/logout')}">
            <span class="icon-power-off"></span> 退出登录
        </a>
    </div>
</div>
<div class="leftnav">
    <div class="leftnav-title"><strong><span class="icon-list"></span>菜单列表</strong></div>
    <h2><span class="icon-user"></span>管理员设置</h2>
    <ul>
        <li><a href="{:U('user/index')}" target="right"><span class="icon-caret-right"></span>修改密码</a></li>
    </ul>
    <div class="item-plain">
        <a href="{:U('goods/add')}" target="right"><span class="icon-tint"></span>教师列表</a>
    </div>
    <div class="item-plain">
        <a href="{:U('goods/add')}" target="right"><span class="icon-leaf"></span>学生列表</a>
    </div>
    <div class="item-plain">
        <a href="{:U('goods/add')}" target="right"><span class="icon-list"></span>提问列表</a>
    </div>
    <h2><span class="icon-superscript"></span>数据统计</h2>
    <ul>
        <li><a href="{:U('statistics/week')}" target="right"><span class="icon-caret-right"></span>一周销售统计</a></li>
        <li><a href="{:U('statistics/month')}" target="right"><span class="icon-caret-right"></span>自然月数据统计</a></li>
        <li><a href="{:U('statistics/today')}" target="right"><span class="icon-caret-right"></span>订单概述</a></li>
    </ul>
</div>

<script type="text/javascript">
    $(function () {
        var navTitlePos = getQueryString("navTitlePos");
        var navChildPos = getQueryString("navChildPos");
        if (navTitlePos == 'goodsList') {
            $('.leftnav h2').removeClass("");
            $("#a_leader_txt").text('商品列表');
            $(".leftnav ul li a").removeClass("on");
            $('#goodsList').addClass('on');
            $('#iframe_right').attr('src', 'goods/index');
            return;
        }
        if (navTitlePos && navChildPos) {
            $('.leftnav h2').removeClass("");
            $("#a_leader_txt").text('');
            $(".leftnav ul li a").removeClass("on");
            $('.leftnav h2').each(function (pindex, element) {
                if (pindex == navTitlePos) {
                    $(this).next().slideToggle(200);
                    $(this).toggleClass("on");
                    //
                    //查找他的下一个兄弟元素
                    var el_lis = $(this).next().children();
                    for (var i = 0; i < el_lis.length; i++) {
                        if (i == navChildPos) {
                            var el_li = el_lis[i];
                            $("#a_leader_txt").text($(el_li).text());
                            $(el_li).children().eq(0).addClass("on");
                            $('#iframe_right').attr('src', $(el_li).children().eq(0).attr('href'));
                            break;
                        }
                    }
                }
            });
        }

        $(".leftnav h2").click(function () {

            if ($('.leftnav h2').next().is("visible")) {
                $('.leftnav h2').next().slideToggle(200);
            }
            $('.leftnav h2').removeClass("on");

            $(this).next().slideToggle(200);
            $(this).toggleClass("on");
        })

        $('.item-plain').click(function () {
            $("#a_leader_txt").text($(this).text());
            $(".leftnav ul li a").removeClass("on");
            $(".leftnav h2").removeClass("on");
            $(this).addClass("on");
        });

        $(".leftnav ul li a").click(function () {
            $("#a_leader_txt").text($(this).text());
            $(".leftnav ul li a").removeClass("on");
            $(this).addClass("on");
        })

        console.log(window.location.search.split('=')[1]);
        decodeURI();
        //退出登录的点击事件
        $("#logout").click(function () {
            //提示框
        });

        //获取出售中和回收站的商品数量
        $.ajax({
            type: "GET",  //提交方式
            url: '/shuidifudao/admin/question/statistic',
            dataType: "json",
            success: function (res) { //返回数据根据结果进行相应的处理
                console.log(res);
                let count_goodson = res.data.count_goodson;
                let count_goodsoff = res.data.count_goodsoff;
                $('#onsale').text("(" + count_goodson + ")");
                $('#offsale').text("(" + count_goodsoff + ")");
            },
            error: function (e) {
                tip('网络异常');
            }
        });
    });


</script>
<ul class="bread ">
    <li><a href="#" target="right" class="icon-home"> 首页</a></li>
    <li><a href="##" id="a_leader_txt">网站信息</a></li>
</ul>
<div class="admin">
    <iframe id="iframe_right" scrolling="auto" frameborder="0" src="{:U('question/index')}" name="right" width="100%"
            height="100%">

    </iframe>
</div>
</body>
</html>